<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>忘记密码</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/member.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <header class="header">
        <div class="header-left">
            <div tapmode onclick="comeBack();" class="nav-left"><img class="icon-back" src="../../icon/icon-back.png"/>
            </div>
        </div>
        <h2>忘记密码</h2>
    </header>
</div>
<div class="header-h" style="padding-top: 1.5rem;"></div>
<section class="html_section pr30 pl30 login_section">
    <div class="f26">
        <div class="line_center"><input class="login_input" placeholder="请输入您的手机号" id="phone"/></div>
        <div class="line_center yzm_box">
            <input class="login_input" id="code" placeholder="请输入验证码"/>
            <div tapmode onclick="getCode()" class="yzm">获取验证码</div>
        </div>
        <div class="line_center"><input class="login_input" placeholder="请设置新密码" id="pwd" type="password"/></div>
        <div class="line_center"><input class="login_input" placeholder="请再次输入" id="repwd" type="password"/></div>
    </div>
    <div tapmode class="btn1 mt100 f30">确认</div>
</section>

</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/login.js"></script>
<script type="text/javascript">
    apiready = function () {
        setFixStatusBar(); //设置状态栏
        keybackListener()
        api.addEventListener({
            name: 'closeCurrWinIndex'
        }, function (ret, err) {
            api.closeWin();
        });
    }

    //获取验证码
    function getCode() {
        hqyzm($("#phone").val(), function (ret) {
            var param = {tel: $("#phone").val(), type: 3};
            pop.loading();
            getAjax(Interface.set_sms, param, function (res) {
                console.log(JSON.stringify(res));
                ret();
                pop.close();
            }, function (ret, err) {

            })
        });
    }

    //获取验证码
    $(".btn1").click(function () {
        var param = {
            tel: $("#phone").val(),
            code: $("#code").val(),
            rePwd: $("#repwd").val(),
            password: $("#pwd").val(),
        };
        if (param.tel == "") {
            pop.notice('请输入您的手机号');
            return
        }
        if (param.code == "") {
            pop.notice('请输入验证码');
            return
        }
        if (param.password != param.rePwd) {
            pop.notice('两次密码不一致');
            return
        }
        pop.loading();
        getAjax(Interface.forget_password, param, function (res) {
            console.log(res);
            pop.close();
            pop.notice('修改成功', 1, function () {
                individualUrl('login');
            });

        }, function (ret, err) {
            pop.close();
            pop.notice(ret.msg);
        })
    })

</script>
